package com.lixin.smartclassroom.ui.home.tab5.activity

import com.drake.brv.utils.bindingAdapter
import com.drake.net.utils.scopeNetLife
import com.lixin.smartclassroom.api.courselist
import com.lixin.smartclassroom.api.zuijinstudent
import com.lixin.smartclassroom.bean.DataListBean
import com.lixin.smartclassroom.databinding.ActivityCourseRecommendBinding
import com.lixin.smartclassroom.ui.home.adapter.courseRecommend
import com.lixin.smartclassroom.ui.home.adapter.recentAttend
import com.lixinkeji.base.BaseActivity
import com.lixinkeji.extension.gone
import com.lixinkeji.extension.visible

/**
 * Description
 * Author: lwc
 * Date:2024/3/12 11:48
 */
class RecentlyEventMoreActivity : BaseActivity<ActivityCourseRecommendBinding>() {
    override fun getViewBinding() = ActivityCourseRecommendBinding.inflate(layoutInflater)

    override fun topBarHide() = false
    override fun startPadding() = true
    private lateinit var listBean: ArrayList<DataListBean>
    override fun title() = "最近活动"


    override fun iniView() {

        binding.recycler.recentAttend()

        binding.apply {
            refresh.onRefresh {
                scopeNetLife {
                    listBean = zuijinstudent(index, 20)!!
                    addData(listBean) {
                        if (binding.recycler.bindingAdapter.models?.size == 0) {
                            binding.state.showEmpty()
                            binding.recycler.gone()
                        } else {
                            binding.recycler.visible()
                        }
                        listBean.size == 10
                    }
                }
            }.autoRefresh()
        }
    }

}